package com.zz.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class HelloController {
    /*
    html页面只能用@Controller注解，且文件后要有.html
     */
    @GetMapping("hello")
    public String hello(){
        return "hello.html";
    }

    /*
    当上面只有@Controller注解，这里还要加上@ResponseBody注解
     */
    @GetMapping("sayHello")
    @ResponseBody
    public String sayHello(){
        return "ok";
    }

}
